<template>
	<div>
		<div class="luo_top_nav_bg">
			<NavigationBar :title="navTitleName">
			</NavigationBar>
		</div>
		<div class="luo_bottom_bg">
			<div class="luo_input_title">
				请输入你提出的宝贵意见
			</div>
			<textarea class="luo_input_feedback" v-model="feedbackValue"></textarea>
			<input class="luo_input_contact_info" v-model="contactInfoValue" placeholder="请输入联系方式 (选填)" />
			<button class="luo_comitButton" @click="comitAction()">提交</button>
			<div class="luo_tip" v-if="isShowTips">正在提交你的宝贵意见，请稍后...</div>
		</div>
		
	</div>
</template>

<script>
	import NavigationBar from '../pages/NavigationBar.vue'
	import $ from 'jquery'
	import UserInfoManager from "../../js/UserInfoManager.js"
	import HTTPUtil from '../../js/HttpUtil.js'
	
	export default {
		components: {
			NavigationBar
		},
		data() {
			return {
				navTitleName:"反馈",
				feedbackValue:"",
				contactInfoValue:"",
				isShowTips:false
			}
		},
		mounted() {
			
		},
		methods: {
			comitAction:function(){
				console.log("feedbackValue:" +this.feedbackValue + "contactInfoValue:"+this.contactInfoValue);
				var params = new URLSearchParams();
				params.append('contactInfo', this.contactInfoValue);
				params.append('descriptioN', this.feedbackValue);
				params.append('sessionkey', UserInfoManager.getInfo().userExt.sessionKey);
				this.isShowTips = true;
				HTTPUtil.post('/report/feedback.do', params)
					.then(response => {
						console.log(response.data);
						if (response.data.code == 0) {
							alert("提交成功");
							// this.$router.back(-1);
						}
						this.isShowTips = false;
					})
					.catch(function(error) {
						console.log(error);
						alert("提交失败");
						this.isShowTips = false;
					});
			}
		}
	}
</script>

<style>
	@import "../../css/MeFeedBack.css";
</style>
